In general, the present invention relates to a texture mapping apparatus for carrying out texture mapping adopted as a technique to drastically improve the expression power of a multidimensional computer graphic system. More particularly, the present invention relates to a picture processing apparatus and a method thereof capable of preventing generation of aliasing and excessive resolution deterioration of a picture, and hence, capable of providing high-quality texture mapping by assigning a proper shrinkage factor when pasting a texture of a 2-dimensional picture on a multidimensional figure. In addition, the present invention can be applied to a wide range of applications such as the CAD (Computer Aided Design), designing work and games.
Texture mapping is a technique of pasting a 2-dimensional picture provided in advance on the surface of a figure in an operation to render the figure by means of computer graphics. Such a 2-dimensional picture is referred to hereafter as a texture. By adopting the texture-mapping technique, a high-quality picture can be obtained.
In order to make the following description easy to understand, the basic principle of the texture-mapping technique is briefly explained by referring to FIGS. 8A, 8B, 9A and 9B. FIG. 8A is a diagram showing a figure, on which a texture is to be pasted, and a coordinate system onto which the figure is mapped. The coordinate system is referred to hereafter as an XY coordinate system 81.
A triangle 80 represents a polygon. A figure to be rendered is created as a set of a plurality of triangles. 3-dimensional coordinates Sn, Tn and Qn where n=1, 2 and 3 are assigned to the vertexes A, B and C of the triangle 80 respectively. Such 3-dimensional coordinates are referred to hereafter as texture coordinates. A figure for the texture coordinates is omitted. Thus, FIG. 8A is a diagram showing the triangle 80 which is expressed in the texture coordinate system and mapped onto the XY coordinate system 81. Coordinates (s, t, q) of a point D inside the triangle 80 are obtained by linear interpolation of the texture coordinates Sn, Tn and Qn where n=1, 2 and 3 of the vertexes A, B and C.
Texture coordinates such as the coordinates (s, t, q) and (Sn, Tn, Qn) described above are assigned to each of individual triangles constituting a figure being rendered. Thus, the texture coordinates are variables. In addition, the texture coordinates Sn, Tn and Qn where n=1, 2 and 3 assigned to the vertexes A, B and C of the triangle 80 correspond to XY coordinates (X, Y) whereas the texture coordinates (s, t, q) assigned to a pixel inside the triangle 80 correspond to XY coordinates (x, y).
On the other hand, FIG. 8B is a diagram showing a 2-dimensional coordinate system of a texture to be pasted on the figure to be rendered as described above. The 2-dimensional coordinate system is referred to as a UV-coordinate system 82. A texture triangle 83 is a triangle constituting a texture to be pasted on the triangle 80. The points (A, B, C and D) mapped onto the XY-coordinate system 81 are associated with the points (Axe2x80x2, Bxe2x80x2, Cxe2x80x2 and Dxe2x80x2) of the texture triangle 83 to be posted.
A texture is initially given on the UV coordinate system 82 as a 2-dimensional picture. The texture is then subjected to operations such as a rotation and a movement and finally mapped onto the XY coordinate system 81. The UV coordinates of the points (Axe2x80x2, Bxe2x80x2, Cxe2x80x2 and Dxe2x80x2) of the texture triangle 83 are expressed in terms of texture coordinates (sn, Tn, Qn where n=1, 2 and 3) and (s, t, q) described above as shown in FIG. 8B.
In addition, FIGS. 9A and 9B are diagrams showing what displacement on the UV coordinate system 82 a component displacement dx of a unit pixel on the XY coordinate system 81 in the X-axis direction corresponds to. As shown in the figure, the component displacement dx in the XY coordinate system 81 corresponds to a component displacement dudx in the U-axis direction and a component displacement dvdx in the V-axis direction on the UV coordinate system 82. Thus, the component displacement dx on the XY coordinate system 81 corresponds to a resultant displacement e={(dudx)2+(dvdx)2}xc2xd on the UV coordinate system 82. This explanation is also applicable to a component displacement dy in the y-axis direction on the XY coordinate system 81. dudx described above is a coordinate value of a displacement in the u direction in the UV coordinate system 82 for the change dx in the XY coordinate system 81. Notation qxc2x7q to be used frequently later means processing to multiply q by q where the symbol q represents any quantity. In order to avoid complexity of the explanation, notation qxc2x7q is used hereafter.
A MIPMAP filtering technique (Multum In Parvo Mapping) is known as a method to obtain a high-quality picture in a texture mapping process. The MIPMAP filtering technique is described in detail with reference to, such as a publication of Addison Wesley entitled xe2x80x9cAdvanced Animation and Rendering Techniques,xe2x80x9d page 140.
The MIPMAP filtering technique is described by referring to FIGS. 5, 6A, 6B, 7A and 7B as follows.
In order to avoid aliasing caused by information which is dropped when a texture is shrunk and pasted as shown in FIG. 5, according to the MIPMAP filtering technique, a plurality of textures completing a filtering process according to the shrinkage factor are prepared in advance. In the example shown in FIG. 5, the textures are the original picture, a half picture, a one-fourth picture and a one-eighth picture. One of the textures is to be selected in accordance with the shrinkage factor of pixels. The reason why pictures with compression factors different from each other are prepared in advance is to reduce a load to be borne during the filtering process of the picture.
The texture mapping process adopting the ordinary MIPMAP filtering technique is described as follows.
1) Texture coordinates (S1, T1, Q1), (S2, T2, Q2) and (S3, T3, Q3) are assigned to the three vertexes of the triangle, respectively.
2) Texture coordinates (s, t, q) of each pixel inside the triangle are found by linear interpolation of the texture coordinates (S1, T1, Q1), (S2, T2, Q2) and (S3, T3, Q3) assigned to the three vertexes.
3) The shrinkage factor lod of each pixel inside the triangle is found by using the texture coordinate (s, t, q)
4) Coordinates U=s/q and V=t/q in the UV coordinate system 82 for each pixel inside the triangle are computed.
5) A texture for a given shrinkage factor lod is selected from a plurality of textures prepared in advance. Each position inside a selected texture is referenced by using the coordinates (U, V) in the UV coordinate system 82.
The shrinkage factor lod of the texture described above indicates how much the original picture is shrunk in the texture mapping process. Different lod values are set for different shrinkage factors as follows.
As an example, the following description explains how to compute the value of lod at texture coordinates (s, t, q) in the triangle, a subject figure to be rendered. In the figure, notations dsdx, dtdx and dqdx denote displacements of s, t and q in the X-axis direction respectively. By the same token, notations dsdy, dtdy and dqdy denote displacements of s, t and q in the Y-axis direction, respectively.
1) Component displacements in the U-axis and V-axis directions of the texture in the UV coordinate system 82 for component displacements dx and dy of a unit pixel in the X-axis and Y-axis directions on the XY coordinate system 81 are found by using Eqs. (1) as follows.
dudx=(sxc2x7dqdxxe2x88x92qxc2x7dsdx)/qxc2x7q
dvdx=(txc2x7dqdxxe2x88x92qxc2x7dtdx)/qxc2x7q
dudy=(sxc2x7dqdyxe2x88x92qxc2x7dsdy)/qxc2x7q
dvdy=(txc2x7dqdyxe2x88x92qxc2x7dtdy)/qxc2x7qxe2x80x83xe2x80x83(1)
2) Resultant displacements in the U-axis and V-axis directions of the texture in the UV coordinate system 82 for resultant displacements of the component displacements dx and dy of a unit pixel in the X-axis and Y-axis directions on the XY coordinate system 81 are found by applying the Pitagoras theorem to the component displacements expressed by Eqs. (1) as follows.
ex={(dudx)2+(dvdx)2}xc2xd(in the U direction)
ey={(dudy)2+(dvdy)2}xc2xd(in the V direction)xe2x80x83xe2x80x83(2)
3) A maximum value of the displacement of the texture in the UV coordinate system 82 for component displacements dx and dy of a unit pixel in the X-axis and Y-axis directions on the XY coordinate system 81 is found by using Eqs. (3) as follows.
e=max(ex, ey)xe2x80x83xe2x80x83(3)
The meaning of Eq. (3) is that e=ex for ex greater than ey, otherwise, e=ey.
The value of the shrinkage factor lod is computed as a log2 function of e found by Eq. (3) as follows:
lod=log2 (e)xe2x80x83xe2x80x83(4)
In the technique to compute the shrinkage factor lod of a texture described above, there presents no problem when a pixel to be rendered is a rectangle. In FIG. 6A a non-interlace picture is shown. In a video signal performing interlaced scanning, such as in an interlace rendering operation as shown in FIG. 6B, however, the resolution in the Y direction of the picture to be rendered is reduced to a half, so that the ratio of horizontal pixels to vertical pixels becomes equal to 2:1. As a result, displacements in the U-axis and V-axis directions for a movement in the Y-axis direction are twice as much as displacements in the U-axis and V-axis directions for a movement in the X-axis direction. Thus, Eq. (3) satisfies e=ey and the shrinkage factor lod is strongly affected by a displacement in the Y-axis direction, becoming a large value in comparison with a non-interlace rendering operation. As a MIPMAP filtering technique shown in FIG. 5, a picture with a high shrinkage factor and a low frequency is selected, raising a problem that a picture thus generated becomes improper and excessively fading/dim in the X-axis direction. A picture with no biases in the X-axis and Y-axis directions is shown in FIG. 7A.; and
In addition, in a perspective projection where a picture is biased in the horizontal and/or vertical direction as shown in FIG. 7B, the picture is affected also in the biased direction to result in a large shrinkage factor. As a result, there is raised a problem of an excessively fading picture.
It is thus an object of the present invention addressing the problems described above to provide a picture processing apparatus and a picture processing method which are capable of preventing an excessively fading picture from being generated in, among others, the case of an interlace rendering operation or a perspective projection biased in the horizontal and/or vertical directions.
In order to achieve the object described above, according to a first aspect of the present invention, there is provided a picture processing apparatus wherein a plurality of 2-dimensional pictures with shrinkage factors different from each other are stored in a memory, one of the 2-dimensional pictures is selected from the memory in accordance with contents of a multidimensional figure to be pasted on the multidimensional figure and the multidimensional figure with the selected 2-dimensional picture pasted thereon is mapped onto a first 2-dimensional coordinate system, the picture processing apparatus comprising: a displacement computing means for computing a plurality of displacements of the 2-dimensional picture on a second 2-dimensional coordinate system prescribing the 2-dimensional picture from multidimensional coordinates of a point inside a triangle constituting the multidimensional figure and a plurality of unit displacements of the point inside the triangle on the first 2-dimensional coordinate system onto which the triangle is mapped; a displacement adjusting means for adjusting the computed displacements of the 2-dimensional picture independently of each other by multiplying the computed displacements at least by numbers; and a shrinkage-factor computing means for computing a shrinkage factor of the 2-dimensional picture to be pasted on the multidimensional figure from the adjusted displacements of the 2-dimensional picture.
According to another aspect of the present invention, there is provided a picture processing method by which a plurality of 2-dimensional pictures with shrinkage factors different from each other are stored in a memory, one of the 2-dimensional pictures is selected from the memory in accordance with contents of a multidimensional figure to be pasted on the multidimensional figure and the multidimensional figure with the selected 2-dimensional picture pasted thereon is mapped onto a first 2-dimensional coordinate system, the picture processing method comprising the steps of: computing a plurality of displacements of the 2-dimensional picture on a second 2-dimensional coordinate system prescribing the 2-dimensional picture from multidimensional coordinates of a point inside a triangle constituting the multidimensional figure and a plurality of unit displacements of the point inside the triangle on the first 2-dimensional coordinate system onto which the triangle is mapped; adjusting the computed displacements of the 2-dimensional picture independently of each other by multiplying the computed displacements at least by numbers; and computing a shrinkage factor of the 2-dimensional picture to be pasted on the multidimensional figure from the adjusted displacements of the 2-dimensional picture.
As described above, a displacement computing means is used for computing a plurality of displacements of a 2-dimensional picture on a second 2-dimensional coordinate system prescribing the 2-dimensional picture from multidimensional coordinates of a point inside a triangle constituting a multidimensional figure and a plurality of unit displacements of the point inside the triangle on the first 2-dimensional coordinate system onto which the triangle is mapped; a displacement adjusting means is used for adjusting the computed displacements of the 2-dimensional picture independently of each other by multiplying the computed displacements at least by numbers; and a shrinkage-factor computing means is used for computing a shrinkage factor of the 2-dimensional picture to be pasted on the multidimensional figure from the adjusted displacements of the 2-dimensional picture.
As a result, with the configuration of the picture processing apparatus and a method thereof according to the present invention, since a MIPMAP filtering process can be carried out by controlling the magnitude of the shrinkage factor, it is possible to suppress generation of an excessively fading picture obtained as a result of interlace rendering or a perspective projection biased in the horizontal and/or vertical direction.